//
//  UIImage+JwSkin.m
//  JwSkinHub
//
//  Created by 陈警卫 on 2023/3/20.
//

#import "UIImage+JwSkin.h"
#import "JwSkinExer.h"

@implementation UIImage (JwSkin)

/// MARK: 根据imageXcassetsKey获取图片
+ (UIImage *)jw_skinImageXcassetsKey:(NSString *)key {
    NSString *imagename = [NSString stringWithFormat:@"%@_%@", key, kJwSkinExer.jw_currentSkin];
    UIImage *image = [[UIImage imageNamed:imagename] imageWithRenderingMode:(UIImageRenderingModeAlwaysOriginal)];
    return image;
}

/// MARK: 根据imageBundleKey获取图片
+ (UIImage *)jw_skinImageBundleKey:(NSString *)key {
    NSString *bundlename = [NSString stringWithFormat:@"%@.bundle", kJwSkinExer.jw_currentSkin];
    NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:bundlename];
    NSBundle *bundle = [NSBundle bundleWithPath:path];
    UIImage *image = [UIImage imageNamed:key inBundle:bundle compatibleWithTraitCollection:nil];
    return image;
}


@end
